package com.sdslzyxyhtgl.modules.zzjg.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.sdslzyxyhtgl.modules.zzjg.entity.JxjgEntity;
import com.sdslzyxyhtgl.modules.zzjg.service.JxjgService;
import com.sdslzyxyhtgl.common.utils.PageUtils;
import com.sdslzyxyhtgl.common.utils.R;



/**
 * 
 *
 * @author wujunfeng
 * @email 2223098767@qq.com
 * @date 2022-06-19 22:27:40
 */
@RestController
@RequestMapping("zzjg/jxjg")
public class JxjgController {
    @Autowired
    private JxjgService jxjgService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("zzjg:jxjg:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = jxjgService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("zzjg:jxjg:info")
    public R info(@PathVariable("id") Integer id){
		JxjgEntity jxjg = jxjgService.getById(id);

        return R.ok().put("jxjg", jxjg);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("zzjg:jxjg:save")
    public R save(@RequestBody JxjgEntity jxjg){
		jxjgService.save(jxjg);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("zzjg:jxjg:update")
    public R update(@RequestBody JxjgEntity jxjg){
		jxjgService.updateById(jxjg);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("zzjg:jxjg:delete")
    public R delete(@RequestBody Integer[] ids){
		jxjgService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
